<?php

include('../../../eccore/ecmall.php');
ecm_define('../../../data/config.inc.php');

require_once("lib/alipay_submit.class.php");

$doc = new DOMDocument();	
//if ($this->_alipay_config['sign_type'] == 'MD5') {
	$doc->loadXML($_POST['notify_data']);
//}
if( ! empty($doc->getElementsByTagName( "notify" )->item(0)->nodeValue) ) {
	//商户订单号
	$out_trade_no = $doc->getElementsByTagName( "out_trade_no" )->item(0)->nodeValue;
	
	//交易状态
	$trade_status = $doc->getElementsByTagName( "trade_status" )->item(0)->nodeValue;
	
	if(in_array($trade_status, array('TRADE_FINISHED','TRADE_SUCCESS'))) {
		echo  "success";
	}
}

$url = SITE_URL . '/mobile/index.php?app=paynotify&act=notify&order_id='.$out_trade_no;
$cacert_url = getcwd().'\\cacert.pem';

getHttpResponsePOST($url, $cacert_url, $_POST);

?>